using System;
using GameFramework.Sound;
using UnityEngine;
using Unity.VisualScripting;
using UnityGameFramework.Runtime;
using ShowEntityDependencyAssetEventArgs = UnityGameFramework.Runtime.ShowEntityDependencyAssetEventArgs;

namespace LS.UGFUnits
{
    [UnitShortTitle("Show Entity")]
    [UnitSurtitle("Dependency Asset")]
    public sealed class ShowEntityDependencyAsset : FrameworkEventUnit<ShowEntityDependencyAssetEventArgs>
    {
        protected override int EventId => ShowEntityDependencyAssetEventArgs.EventId;
        protected override string HookName => UGFHookNames.ShowEntityDependencyAsset;

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput EntityId
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput EntityLogicType
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput EntityAssetName
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput EntityGroupName
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput DependencyAssetName
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput LoadedCount
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput TotalCount
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput UserData { get; private set; }

        protected override void Definition()
        {
            base.Definition();
            EntityId = ValueOutput<int>(nameof(EntityId));
            EntityLogicType = ValueOutput<Type>(nameof(EntityLogicType));
            EntityAssetName = ValueOutput<string>(nameof(EntityAssetName));
            EntityGroupName = ValueOutput<string>(nameof(EntityGroupName));
            DependencyAssetName = ValueOutput<string>(nameof(DependencyAssetName));
            LoadedCount = ValueOutput<int>(nameof(LoadedCount));
            TotalCount = ValueOutput<int>(nameof(TotalCount));
            UserData = ValueOutput<string>(nameof(UserData));
        }

        protected override void AssignArguments(Flow flow, ShowEntityDependencyAssetEventArgs args)
        {
            base.AssignArguments(flow, args);
            flow.SetValue(EntityId, args.EntityId);
            flow.SetValue(EntityLogicType, args.EntityLogicType);
            flow.SetValue(EntityAssetName, args.EntityAssetName);
            flow.SetValue(EntityGroupName, args.EntityGroupName);
            flow.SetValue(DependencyAssetName, args.DependencyAssetName);
            flow.SetValue(LoadedCount, args.LoadedCount);
            flow.SetValue(TotalCount, args.TotalCount);
            flow.SetValue(UserData, args.UserData);
        }
    }
}